package com.ysd.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ysd.dao.impl.CompanyDaoImpl;
import com.ysd.dao.impl.ProductCategoryDaoImpl;
import com.ysd.dao.impl.ProductDaoImpl;
import com.ysd.entity.Company;
import com.ysd.entity.Product;
import com.ysd.entity.ProductCategory;

public class MoHuServlet extends HttpServlet {
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		CompanyDaoImpl cDao = new CompanyDaoImpl();
		Company c = cDao.getCompany();
		
		request.setAttribute("c", c);
		//MoHuServlet映射名mohu
		String productName=request.getParameter("mohu");
		
		ProductDaoImpl mhDao=new ProductDaoImpl();
		List<Product> mhList =mhDao.getProductList21(productName);
		request.setAttribute("mhList", mhList);
		
		ProductCategoryDaoImpl psDao=new ProductCategoryDaoImpl();//ProductCategoryDaoImp详情列表实体类
		
		List<ProductCategory> ps =psDao.getProductCategory();
		request.setAttribute("ps",ps);
		
		request.getRequestDispatcher("mohu.jsp").forward(request, response);
	}

	
}
